<template>
  <div id="home">
    <el-container>
      <el-header>
        <Toolbar></Toolbar>
      </el-header>
      <el-container class="container">
        <el-aside width="250px">
          <ComponentsList></ComponentsList>
          <RealTimeComponentList></RealTimeComponentList>
        </el-aside>
        <el-main>
          <div class="canvas dec-scrollbar">
            <Editor :style="formatCanvasStyle"></Editor>
          </div>
        </el-main>
        <el-aside width="288px" class="dec-scrollbar">
          <Attribute></Attribute>
        </el-aside>
      </el-container>
    </el-container>
    <Preview></Preview>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

import ComponentsList from "@/components/componentsList/ComponentsList.vue";
import RealTimeComponentList from "@/components/componentsList/RealTimeComponentList.vue";
import Editor from "@/components/Editors/Editor.vue";
import Toolbar from "@/components/Toolbar/Toolbar.vue";
import Attribute from "@/components/Attribute/Attribute.vue";
import Preview from "@/components/Editors/Preview.vue";
import { listenGlobalKeydown } from "@/utils/shortcutKey.js";
export default {
  name: "home",
  components: {
    ComponentsList,
    RealTimeComponentList,
    Editor,
    Toolbar,
    Attribute,
    Preview,
  },
  computed: {
    ...mapGetters(["formatCanvasStyle"]),
  },
  created() {
    listenGlobalKeydown();
  },
};
</script>

<style lang="less" scoped>
.el-container {
  height: 100%;
}

.container {
  height: calc(100% - 64px);
}
.el-header {
  background-color: skyblue;
  padding: 0;
}
.el-aside {
  height: 100%;
}
.el-main {
  margin-top: 3px;
  background-color: #f5f5f5;
}

.canvas {
  width: 100%;
  height: 100%;
  overflow: auto;
}
</style>

<style lang="less">
#home {
  height: 100%;
}
</style>
